package com.naiterui.ehp.bs.esign.api.scca.entity;/**
 * @author guoyongxiang
 * @date 2021/2/26 13:18
 * @since 1.0.0
 */

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;
import lombok.Builder;
import lombok.Data;

/**
 * 四川CA证书信息表
 *
 * @author guoyongxiang
 * @version 1.0.0
 * @date 2021/2/26 13:18
 **/
@Builder
@Data
@Table(name = "esign_scca_cert")
@Entity
public class EsignSccaCert {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private Long id;

    /**
     * OPEN_ID
     */
    @Column(name = "open_id")
    private String openId;

    @Column(name = "name")
    private String name;

    @Column(name = "card_type")
    private Integer cardType;

    @Column(name = "card_no")
    private String cardNo;

    /**
     * 签名值证书
     */
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "cert_base64", columnDefinition = "text")
    private String certBase64;

    /**
     * 证书链
     */
    @Basic(fetch = FetchType.LAZY)
    @Column(name = "cert_p7", columnDefinition = "text")
    private String certP7;

    /**
     * 证书序列号
     */
    @Column(name = "cert_serialnumber")
    private String certSerialnumber;

    /**
     * 证书生效日期
     */
    @Column(name = "not_before_at")
    private Date notBefore;

    /**
     * 证书失效日期
     */
    @Column(name = "not_after_at")
    private Date notAfter;

    /**
     * 创建时间
     */
    @Column(name = "created_at")
    private Date createdAt;

    /**
     * 修改时间
     */
    @Column(name = "changed_at")
    private Date changedAt;

    @Version
    private Integer version;

}
